<?php
// +----------------------------------------------------------------------
// | EasyAdmin
// +----------------------------------------------------------------------
// | PHP交流群: 763822524
// +----------------------------------------------------------------------
// | 开源协议  https://mit-license.org 
// +----------------------------------------------------------------------
// | github开源项目：https://github.com/zhongshaofa/EasyAdmin
// +----------------------------------------------------------------------
namespace app\model\api;


use laytp\BaseModel;

class GenshinWeapon extends BaseModel
{
    protected $deleteTime = 'delete_time';

    /**
     * 武器图片
     * @return array
     */
    public function getWeaponInfo(){
        $list = $this->cache(true)->column('icon,name,"weapon" as type', 'name');
        return $list;
    }

    /**
     * 根据id获取武器信息
     * @return array
     */
    public function weaponInfo(){
        $list = $this->cache(true)
            ->column('icon,name,weapon_id,rarity as stars', 'weapon_id');
        return $list;
    }

    /**
     * 获取所有武器
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getAllWeapon(){
        $list = $this->field('weapon_id,name,icon')
            ->cache(true)->select()->toArray();

        return $list;
    }
}